package com.hhy.hhy_weibo.controller;

import com.hhy.hhy_weibo.common.api.ApiResult;
import com.hhy.hhy_weibo.model.domain.BmsComment;
import com.hhy.hhy_weibo.model.domain.BmsTip;
import com.hhy.hhy_weibo.model.domain.UmsUser;
import com.hhy.hhy_weibo.model.dto.CommentDTO;
import com.hhy.hhy_weibo.model.dto.TipDTO;
import com.hhy.hhy_weibo.serviec.IBmsTipService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/tip")
public class BmsTipController extends BaseController{

    @Resource
    private IBmsTipService iBmsTipService;

    @GetMapping("/today")
    public ApiResult<BmsTip> getRandomTip() {
        BmsTip tip = iBmsTipService.getRandomTip();
        return ApiResult.success(tip);
    }

    @GetMapping("/get_tip")
    public  ApiResult<List<BmsTip>> getAllTip() {
        return ApiResult.success(iBmsTipService.getAllTip());
    }

    @DeleteMapping("/delete/{id}")
    public ApiResult<String> delete(@PathVariable("id") String id) {
        iBmsTipService.removeById(id);
        return ApiResult.success(null,"评论删除成功");
    }
}
